package com.xy.manage.service.impl;


import java.util.List;
import java.util.Map;
import java.util.Date;
import com.xy.core.util.BeanUtil;
import com.xy.common.page.Pagination;
import com.xy.core.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.xy.manage.dao.TsurveypartnerDao;
import com.xy.manage.model.Tsurveypartner;
import com.xy.manage.service.TsurveypartnerService;

@Service
@Transactional
public class TsurveypartnerServiceImpl extends BaseServiceImpl<Tsurveypartner> implements
		TsurveypartnerService {
	private TsurveypartnerDao tsurveypartnerDao;

	public TsurveypartnerServiceImpl(TsurveypartnerDao paramAppRoleDao) {
		super(paramAppRoleDao);
		this.tsurveypartnerDao = paramAppRoleDao;
	}

	@Override
	public boolean checkExist(String paraName, String paraValue) {
		return tsurveypartnerDao.checkExist("Tsurveypartner", paraName, paraValue);
	}

	@Override
	public List<Tsurveypartner> getTsurveypartner(Map<String, Object> map) {
		return tsurveypartnerDao.getTsurveypartner(map);
	}
	@Override
	public Pagination getTsurveypartnerByPage(Map<String, Object> map, int pageNo,
			int pageSize) {
		// TODO Auto-generated method stub
		return tsurveypartnerDao.getTsurveypartnerByPage(map, pageNo, pageSize);
	}
	 
   @Override
	public Tsurveypartner save(Tsurveypartner tsurveypartner) {
	//	tsurveypartner.setModtime(new Date());
		if(tsurveypartner.getPartnerid()==null){
			//新增
        	return super.save(tsurveypartner);
		}else{
			//更新
			Tsurveypartner tsurveypartner1=tsurveypartnerDao.get(tsurveypartner.getPartnerid());
			try {
				BeanUtil.copyNotNullProperties(tsurveypartner1, tsurveypartner);
			} catch (Exception e) {
				e.printStackTrace();
			}  
			return super.save(tsurveypartner1);
		}
	}
}